/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.ipn.escuela.web.tag;

import java.io.IOException;
import java.util.List;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import mx.ipn.escuela.dao.MaestroDao;
import mx.ipn.escuela.modelo.Maestro;

/**
 *
 * @author jdmr
 */
public class MaestroTag extends SimpleTagSupport {

    /**
     * Called by the container to invoke this tag.
     * The implementation of this method is provided by the tag library developer,
     * and handles all tag processing, body iteration, etc.
     */
    @Override
    public void doTag() throws JspException, IOException {
        MaestroDao dao = new MaestroDao();
        List<Maestro> maestros = dao.lista();
        for (Maestro maestro : maestros) {
            getJspContext().setAttribute("maestro", maestro);
            getJspBody().invoke(null);
        }
    }
}
